<?php get_header(); ?>
<div id="container">
<div id="left">


<div class="blok">
 <?php if (have_posts()) : ?>
	<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
	<?php /* If this is a category archive */ if (is_category()) { ?>
<h1>Архив рубрики "<?php single_cat_title(); ?>" </h1>
	<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
	<h1>Записи с меткой "<?php single_tag_title(); ?>"</h1>
	<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
	<h1>Архив за <?php the_time(' j F Y'); ?></h1>
	<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
<h1>Архив  <?php the_time(' F  Y'); ?></h1>
	<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
<h1>Архив  <?php the_time('Y'); ?></h1>
	<?php /* If this is an author archive */ } elseif (is_author()) { ?>
<h1>Архив автора  <?php the_author_posts_link(); ?></h1>
	<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h1>Архив блога</h1>
	<?php } ?>

</div>
<div style="clear:both;"></div>


<div class="blok">

  <?php while (have_posts()) : the_post(); ?>
<div class="boxgrid slidedown">	
	<?php $thumb = get_post_meta($post->ID, 'postimage', $single = true); ?>
<?php 
if($thumb !== '') { ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><img src="<?php bloginfo('stylesheet_directory'); ?>/timthumb.php?src=<?php echo $thumb; ?>&amp;h=170&amp;w=260&amp;q=50&amp;zc=1" alt="<?php if($thumb_alt !== '') { echo $thumb_alt; } else { echo the_title(); } ?>"  class="cover" /></a>
<?php }
else { echo ''; } ?>
<h3><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
			<p><?php the_content_limit("140", "Далее &raquo;"); ?></p>
			<p class="details"> <?php the_time('d m  Y') ?> |  <?php the_category(' - ') ?></p>
</div>
	<?php endwhile; ?>
	<div class="wp-pagenavi"><?php if(function_exists('wp_pagenavi')) { wp_pagenavi(); } ?></div>
	<?php endif; ?>
	</div>	</div>
 <?php get_sidebar(); ?>
<div style="clear:both;"></div>
</div><!--container-->  	
<?php get_footer(); ?>